env = Environment(tools = [])
nodes = env.Command("foo", ["bar", "qux"], "blah -o $TARGET $SOURCES")
env.Command("bar", "blah_baz.blah", "blah -o $TARGET $SOURCE")
env.Command("qux", "quux", "blah -o $TARGET $SOURCE")
env.Default("foo")

node = env.Entry("quux")
print node
print str(nodes)
print env.subst("blah")
print env.subst("${CC}")
print env.subst("blah $blah blah")
env["varname"] = [1,2,3]
env["varname"][1] = 5
print env["varname"]
print env.subst("${varname[1]}")

from SCons.Action import Action
def f(target, source, env):
	print "FFFFFFFFFFFFF"

env.Execute(Action(f))

def e(target, source, env):
    print target
    print source
    print env
    return (target, source)

from SCons.Builder import Builder
builder = Builder(action = { ".blah" : "blah_builder $TARGETS -- $SOURCES" }, target_factory = env.File, prefix = "blah_", suffix = "blah", src_suffix = "blah", emitter = e)
env.Append(BUILDERS = { "Blah" : builder })
env.Blah("baz", "s")

env["blah"] = ["str"]
env.Append(blah = "str2")
print env["blah"]
env.Append(blah = "str3")
print env["blah"]
env.Prepend(blah = "str10")
print env["blah"]

env.Append(blahdict = {1:45, 4:4})
print env["blahdict"]
env.Append(blahdict = {2:"n"})
print env["blahdict"]

env["blahunique"] = ["a", "b", "c"]
env.AppendUnique(blahunique = ["b", "d"])
print env["blahunique"]

env.Replace(replace_var = "blah")
print env["replace_var"]

print env.WhereIs("bash")

import SCons.Defaults
env.Command("quux", "SConstruct", SCons.Defaults.Copy("$TARGET", "$SOURCE"))

def Custom(self):
	print "Custom"

env.AddMethod(Custom)
env.Custom()

env.SetDefault(def_var = "val", replace_var = "val")
print env["def_var"]
print env["replace_var"]

env2 = env.Clone()
env["ccc"] = "ccc"
env2["ccc2"] = "ccc"
env["varname"][1] = "ccc"
env["replace_var"] = "ccc"
#print env.Dump()
#print env2.Dump()

exported = "exported"
Export("env", "exported")
SConscript("subdir/SConscript")
